<!--
  Generated template for the InstorePage page.

  See http://ionicframework.com/docs/components/#navigation for more info on
  Ionic pages and navigation.
-->
<ion-header>

  <ion-navbar>
    <ion-title>产品入库</ion-title>
  </ion-navbar>

</ion-header>


<ion-content>

  <ion-list>
    <ion-item>
      <ion-label>入库类型</ion-label>
      <ion-select [(ngModel)]="storeType" interface="popover">
        <ion-option value="{{item.value}}" *ngFor="let item of storeTypes">{{item.name}}</ion-option>
      </ion-select>
    </ion-item>
    <ion-item>
      <ion-label>仓库</ion-label>
      <ion-select [(ngModel)]="houseId" interface="popover">
        <ion-option value="{{item.sp_house__house_id}}" *ngFor="let item of houses">{{item.sp_house__house_name}}
        </ion-option>
      </ion-select>
    </ion-item>
    <ion-item>
      <ion-label>业务员</ion-label>
      <ion-input type="text" placeholder="请选择" disabled="true" (tap)="selUser()" [(ngModel)]="userName"></ion-input>
    </ion-item>
  </ion-list>

  <ion-list id="detail">
    <ion-item>
      <ion-label fixed>产品明细</ion-label>
      <ion-input type="hidden"></ion-input>
    </ion-item>
    <ion-list>
      <ion-item-sliding *ngFor="let item of details; let i = index" (tap)="edit(i)">
        <ion-item>
          <div class="detail-item">
            <p class="detail-title">{{item.sp_catalog__sp_name}}</p>
            <div class="detail-content">
              <p>{{item.sp_catalog__sp_type}}</p>
              <span>数量：{{item.sp_catalog__in_num || 1}}</span>
              <span>单价：{{item.sp_catalog__tax_price | currency:"¥"}}</span>
            </div>
          </div>
          <ion-badge item-end>{{item.sp_catalog__tax_money| currency:"¥"}}</ion-badge>

          <!-- <ion-meter buyNumber='{{item.sp_catalog__in_num || 1}}' maxQty='9999' minQty='1' 
                goods="{{item.sp_catalog__sp_code}}" (onUpdate)="getData($event,item)"></ion-meter> -->
        </ion-item>
        <ion-item-options class="button-assertive"><button class="del" (tap)="delete(item)">删除</button>
        </ion-item-options>
      </ion-item-sliding>
    </ion-list>
    <ion-item class="add-border">
      <ion-row>
        <ion-col col-6 (tap)="scan()">
          <ion-icon style="font-size: 30px;" name="barcode" class="theme-icon"></ion-icon>
        </ion-col>
        <ion-col col-6 (tap)="selSpare(($event))">
          <ion-icon style="font-size:35px" name="add" class="theme-icon"></ion-icon>
        </ion-col>
      </ion-row>

    </ion-item>
  </ion-list>
  <ion-list>
    <ion-item>
      <ion-label position="stacked">备注</ion-label>
      <ion-textarea rows="3" placeholder="输入备注" [(ngModel)]="memo"></ion-textarea>
    </ion-item>
  </ion-list>

</ion-content>

<ion-footer>
  <button ion-button full icon-start (tap)="commit()" class="theme-button-bg">
    <ion-icon name="checkmark"></ion-icon>
    提交
  </button>
</ion-footer>
